Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
How can I "click" all div in the firefox console?

How can I perform a "click" action on all the rows that start with "label style-scope ytcp-button" in the following html:

<div class="label style-scope ytcp-button">Edit Draft</div>

Here what i tried

$("div[class^=label style-scope ytcp-button]")​​​​​​​​​​​​​​.click();

it seem not work.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can use the simple JS method querySelectorAll().

const els = document.querySelectorAll('.label.style-scope.ytcp-button');

els.forEach((el) => {
  el.click();
  console.log('clicked');
});

about 4 years ago · Juan Pablo Isaza Report

0

You have missed the Apostrophe. You should write like this:-

         $("div[class^='label style-scope ytcp-button']").click();

Run the code snippet below, it will not run alert method on clicking on the last div as the "ytcp-button" class is missing in the last div.

$(document).ready(function(){
    $("div[class^='label style-scope ytcp-button']").click(function(){
        alert("You have Click a Specific Class");
    });
});
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="label style-scope ytcp-button">It will Show Alert</div>
    <div class="label style-scope ytcp-button">It will Show Alert</div>
    <div class="label style-scope ytcp-button">It will Show Alert</div>
    <div class="label style-scope">It will not Show Alert</div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
    <script src="script.js"></script>
</body>
</html>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!